import { SET_TOKEN, SET_URSER_INFO, SET_MENULIST, SET_ROLELIST } from './types'

//执行token更新的action
export const tokenAct = token => {
    return {type:SET_TOKEN, token}
}

// 用户信息
export const userInfoAct = userInfo => {
    return {type: SET_URSER_INFO, userInfo}
}

// 菜单
export function menulistAct(menuList) {
    return {type: SET_MENULIST,menuList}
}

//权限
export const rolelistAct = roleList => ({type: SET_ROLELIST, roleList})

// //执行用户数据更新的action
// export const userInfoAct = (id) => {
//     return async function(dispatch) {
//         let userInfo = await asyncFunc()
//         dispatch({type:SET_URSER_INFO, userInfo})
//     }
// }

// function asyncFunc() {
//     return new Promise(resolve => {
//         resolve({id:'admin',name:'超级管理员'})
//     })
// }


// export const userInfoAct = userInfo => {
//     debugger
//     return {type: SET_URSER_INFO,userInfo}
// }